
function U0d = getU0d(params)

BETTA    = params.BETTA;
B        = params.B;
CHI      = params.CHI;
CHI0     = params.CHI0;
THETA    = params.THETA;
DELTA    = params.DELTA;
PHI      = params.PHI;
ETA      = params.ETA;
ZI       = params.ZI;
NU       = params.NU;
MUZss    = params.MUZss;
lss      = params.lss;
KoY      = params.KoY;
PAIss    = params.PAIss;
CRRA     = params.CRRA;
ALFA     = params.ALFA;
%% Section 2: Solving for the steady state
% The real stoch discount factor
Mreal      = BETTA*MUZss^(-CHI*(1-CHI0)-CHI0);

% Value of capital
Kss        = ((4*KoY)^(1/(1-THETA)))*lss;  

% The output level
OUTPUTss   = Kss^THETA*lss^(1-THETA);

% The consumption level
Css        = (1-ZI/2*(PAIss/PAIss^NU-1)^2)*OUTPUTss - DELTA*Kss;

% Marginal costs
MCss       = 1/(ETA*OUTPUTss)*(ZI*(PAIss/PAIss^NU-1)*OUTPUTss*PAIss/PAIss^NU ...
               -(1-ETA)*OUTPUTss + ZI*Mreal*(PAIss/PAIss^NU-1)*PAIss/PAIss^NU*OUTPUTss*MUZss);

% The real wage
Wss        = MCss*(1-THETA)*Kss^THETA*lss^(-THETA);

% The parameter on disutility
PHIzero    = ((Css-B*Css*MUZss^-1)/Css^CHI0)^-CHI*Wss*(1-lss)^(1/PHI)/Css^CHI0;

% CRRA
term1 = Css^(CHI0*(CHI-1)+1)/((Css-B*Css*MUZss^-1)^CHI*(1-CHI));
term2 = CRRA - CHI/(1-B*MUZss^-1+Wss/Css*CHI*(1-lss)/(1/PHI));
term3 = (1-B*MUZss^-1) + Wss/Css*(1-lss)*(1-CHI)/(1-1/PHI);
U0d   = term1*(ALFA*(1-CHI)/term2-term3); 


end